<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateMortgageDetailsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('mortgage_details', function (Blueprint $table) {
            $table->id();
            $table->integer('serial_number')->default(1)->comment('还款期数');
            $table->string('order_sn')->default('')->comment('订单编号');
            $table->string('plate_number')->default('')->comment('车牌号');
            $table->string('borrower')->default('')->comment('借款人');
            $table->integer('number')->default(0)->comment('总还款期数');
            $table->decimal('money',10,2)->comment('每月还款金额');
            $table->timestamp('return_start')->nullable()->comment('每月还款开始时间');
            $table->timestamp('return_end')->nullable()->comment('每月还款结束时间');
            $table->timestamp('return_time')->nullable()->comment('当前还款时间');
            $table->tinyInteger('status')->default(1)->comment('1已还2未还');
        });
        \DB::statement("ALTER TABLE `mortgage_details` comment '车辆按揭还款记录'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('mortgage_details');
    }
}
